Skip to content

docs: add documentation style guide and linting infrastructure#145

Closed
xijing21 wants to merge 1 commit into
ruyisdk:zhfrom
xijing21:feat-guide
Closed

docs: add documentation style guide and linting infrastructure#145
xijing21 wants to merge 1 commit into
ruyisdk:zhfrom
xijing21:feat-guide

Conversation

@xijing21

@xijing21 xijing21 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator
  • Add DOCUMENTATION_STYLEGUIDE.zh.md: comprehensive writing standards
    covering Markdown syntax, Chinese typography, tables, code blocks,
    links, images, and Docusaurus-specific conventions
  • Add DOCUMENTATION_LINTING.zh.md: markdownlint-cli2 based local
    checking, auto-fix, and PR CI gate configuration
  • Add .markdownlint-cli2.yaml: rule configuration aligned with style guide
  • Update README.md: add reference to style guide in contribution section
  • Update CONTRIBUTING.zh.md: add documentation guidelines and linting
    setup to PR workflow
  • Add markdown-lint.yml: add markdown Lint PR CI for branche restructure-zh

Summary by Sourcery

Introduce a formal documentation style guide and markdown linting workflow for the RuyiSDK docs repository, and integrate these into contributor guidelines and CI.

Build:

  • Add a centralized markdownlint-cli2 configuration file for docs Markdown/MDX formatting rules aligned with the style guide.

CI:

  • Add a GitHub Actions workflow to run markdownlint-cli2 on docs changes for the restructure-zh branch as a PR gate.

Documentation:

  • Add a comprehensive Chinese documentation style guide covering structure, Markdown syntax, typography, assets, links, Docusaurus conventions, and contributor checklists.
  • Add a companion documentation linting guide describing markdownlint-cli2 setup, usage, and workflow integration for local development and PR review.
  • Update README to describe docs branches and reference the documentation style guide and contribution guidelines.
  • Add bilingual contributing guides (English and Chinese) that incorporate documentation standards and DCO requirements.

Signed-off-by: xijing21 <xijing@iscas.ac.cn>
@sourcery-ai

sourcery-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR introduces a formal documentation style guide and markdown linting infrastructure, wires them into contributor workflows, and adds a CI gate for Markdown quality on the restructure-zh branch.

Sequence diagram for the updated documentation contribution and linting workflow

sequenceDiagram
    actor Contributor
    participant VSCode_markdownlint as VSCode_markdownlint
    participant markdownlint_cli2 as markdownlint-cli2
    participant Repo as GitHub_repo
    participant MarkdownLintCI as markdownlint-cli2-action

    Contributor->>VSCode_markdownlint: Edit docs/*.md, docs/*.mdx
    VSCode_markdownlint-->>Contributor: Inline lint warnings

    Contributor->>markdownlint_cli2: npm run lint:md
    markdownlint_cli2-->>Contributor: Report markdown issues
    Contributor->>markdownlint_cli2: npm run lint:md:fix
    markdownlint_cli2-->>Contributor: Auto-fix markdown issues

    Contributor->>Repo: git push
    Contributor->>Repo: Open pull_request (restructure-zh)

    Repo->>MarkdownLintCI: Trigger Markdown Lint workflow
    MarkdownLintCI->>markdownlint_cli2: Run markdownlint-cli2 "docs/**/*.{md,mdx}"
    markdownlint_cli2-->>MarkdownLintCI: Lint results
    MarkdownLintCI-->>Repo: PR status (success/failure)
    Repo-->>Contributor: CI gate blocks/allows merge
Loading

File-Level Changes

Change Details Files
Add a comprehensive Chinese documentation style guide that standardizes Markdown usage, typography, links, images, Docusaurus conventions, and sidebar management.
  • Define file and directory naming rules, front matter requirements, and static asset placement.
  • Specify Markdown syntax rules for headings, lists, code blocks, tables, links, and admonitions.
  • Describe Chinese typographic norms, spacing, punctuation, and proper casing for technical terms.
  • Document Docusaurus-specific practices such as autogenerated sidebars, front matter fields, MD vs MDX differences, and admonition usage.
  • Provide a pre-PR checklist and a FAQ section mapping common pitfalls to resolutions.
DOCUMENTATION_STYLEGUIDE.zh.md
Add a documentation linting guide describing how to use markdownlint-cli2 locally and in CI, and how rules map to the style guide.
  • Explain installation and IDE integration of markdownlint-cli2, including VS Code and JetBrains setups.
  • Define npm scripts for linting and auto-fixing Markdown/MDX files.
  • Describe the .markdownlint-cli2.yaml configuration at a high level and its relationship to the style guide sections.
  • Detail recommended contributor workflow combining IDE hints, local lint/fix, and CI checks.
  • Document the GitHub Actions-based CI gate behavior, branches it applies to, and troubleshooting steps.
DOCUMENTATION_LINTING.zh.md
Introduce a centralized markdownlint-cli2 configuration to enforce documentation style rules across docs.
  • Configure file globs to lint all Markdown and MDX files under the docs tree while ignoring build and versioned directories.
  • Enable default markdownlint rules and selectively override or disable them to align with the documented style guide.
  • Enforce fenced backtick code blocks, dash-based unordered lists, compact table style with leading/trailing pipes, and alt text for images.
  • Relax or disable rules that conflict with project realities such as line length, inline HTML usage, front-matter before headings, and certain link behaviors.
.markdownlint-cli2.yaml
Add a markdown lint CI workflow using markdownlint-cli2-action, scoped to the restructure-zh branch and doc paths.
  • Configure a GitHub Actions workflow that runs on pushes and pull requests targeting the restructure-zh branch.
  • Limit CI linting to Markdown and MDX files under the docs directory.
  • Run markdownlint-cli2-action with project-specific globs and without auto-fix, acting purely as a read-only gate.
  • Set basic job parameters including Ubuntu runner version and timeout to keep the workflow predictable.
.github/workflows/markdown-lint.yml
Introduce and update contributor documentation to reference the new style guide and linting process, including DCO and PR workflow details.
  • Add an English CONTRIBUTING.md with DCO explanation, sign-off instructions, and CI enforcement, plus links to the documentation style and linting guides.
  • Add a Chinese CONTRIBUTING.zh.md mirroring the contribution, DCO, and PR process guidance, and emphasizing use of the style guide and linting scheme.
  • Clarify that documentation PRs must follow the style guide and that CI will block merges lacking DCO sign-offs or proper formatting.
CONTRIBUTING.md
CONTRIBUTING.zh.md
Update the README to document branch roles and point contributors to the documentation style guide and contribution docs.
  • Document the role of main, zh, gh-pages, and restructure-zh branches in the docs repository.
  • Add a short contribution flow specifically for documentation, including reading the Chinese style guide before writing and submitting PRs.
  • Link to the Chinese and English contributor guides to give a single entry point for full contribution and DCO requirements.
  • Note that docs are built via the main ruyisdk-website repository and direct readers to that repo’s README for local preview instructions.
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@xijing21 xijing21 closed this Jul 16, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/markdown-lint.yml" line_range="3-12" />
<code_context>
+    branches:
+      - restructure-zh
+    paths:
+      - 'docs/**/*.md'
+      - 'docs/**/*.mdx'
+
+jobs:
</code_context>
<issue_to_address>
**suggestion (performance):** The path filter is applied only to pull_request, so pushes touching non-doc files will also trigger the workflow.

Because `paths` is only set under `pull_request`, any push to `restructure-zh` will run markdownlint even if no `docs/` files changed. If you only want linting on documentation changes, consider adding the same `paths` filter under `push` to avoid unnecessary CI runs.

```suggestion
on:
  push:
    branches:
      - restructure-zh
    paths:
      - 'docs/**/*.md'
      - 'docs/**/*.mdx'
  pull_request:
    branches:
      - restructure-zh
    paths:
      - 'docs/**/*.md'
      - 'docs/**/*.mdx'
```
</issue_to_address>

### Comment 2
<location path="DOCUMENTATION_LINTING.zh.md" line_range="15-16" />
<code_context>
+4. [本地使用方式](#4-本地使用方式)
+5. [完整工作流总结](#5-完整工作流总结)
+6. [PR CI 门禁](#6-pr-ci-门禁)
+7. [常见问题与故障排查](#8-常见问题与故障排查)
+8. [配套文件清单](#9-配套文件清单)
+
+## 1. 概述
</code_context>
<issue_to_address>
**issue (bug_risk):** 目录中第 7、8 项的锚点编号与后文标题不一致,可能导致内部链接失效。

目录中第 7、8 项分别链接到 `#8-常见问题与故障排查``#9-配套文件清单`,而对应标题为 `## 7. 常见问题与故障排查``## 8. 配套文件清单`,生成的锚点应为 `#7-…``#8-…`。请将目录中的锚点改为 `#7-常见问题与故障排查``#8-配套文件清单`,以确保跳转正常。
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +3 to +12
on:
push:
branches:
- restructure-zh
pull_request:
branches:
- restructure-zh
paths:
- 'docs/**/*.md'
- 'docs/**/*.mdx'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (performance): The path filter is applied only to pull_request, so pushes touching non-doc files will also trigger the workflow.

Because paths is only set under pull_request, any push to restructure-zh will run markdownlint even if no docs/ files changed. If you only want linting on documentation changes, consider adding the same paths filter under push to avoid unnecessary CI runs.

Suggested change
on:
push:
branches:
- restructure-zh
pull_request:
branches:
- restructure-zh
paths:
- 'docs/**/*.md'
- 'docs/**/*.mdx'
on:
push:
branches:
- restructure-zh
paths:
- 'docs/**/*.md'
- 'docs/**/*.mdx'
pull_request:
branches:
- restructure-zh
paths:
- 'docs/**/*.md'
- 'docs/**/*.mdx'

Comment on lines +15 to +16
7. [常见问题与故障排查](#8-常见问题与故障排查)
8. [配套文件清单](#9-配套文件清单)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): 目录中第 7、8 项的锚点编号与后文标题不一致,可能导致内部链接失效。

目录中第 7、8 项分别链接到 #8-常见问题与故障排查#9-配套文件清单,而对应标题为 ## 7. 常见问题与故障排查## 8. 配套文件清单,生成的锚点应为 #7-…#8-…。请将目录中的锚点改为 #7-常见问题与故障排查#8-配套文件清单,以确保跳转正常。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant